package com.hongdee.base.imp.entity;

import com.hongdee.base.entity.BaseEntity;
import com.hongdee.base.entity.PropertyVo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Map;

/**
 * 名  称:TDataEntityProperty
 * 类  型: class
 * 描  述: 数据实体类
 * 路  径:com.hongdee.base.imp.entity
 * 作  者:zhaohc
 * 日  期:2017/2/15
 */
@Entity
@Table(name = "T_DATA_ENTITY_PROPERTY")
public class TDataEntityProperty  extends BaseEntity {

    @Column(name = "entity_id", length = 32, columnDefinition = " VARCHAR(32) COMMENT '数据实体关联主键' ")
    private String entityId;

    @Column(name = "property_title", length = 64, columnDefinition = " VARCHAR(64) COMMENT '属性显示名称' ")
    private String propertyTitle;

    @Column(name = "property_name", length = 32, columnDefinition = " VARCHAR(32) COMMENT '属性名' ")
    private String propertyName;

    @Column(name = "property_type", length = 32, columnDefinition = " VARCHAR(32) COMMENT '属性类型' ")
    private String propertyType;

    @Column(name = "disp_index",  columnDefinition = " integer COMMENT '显示顺序' ")
    private int dispIndex;

    public TDataEntityProperty()
    {}

    public TDataEntityProperty(String entityId, PropertyVo pv)
    {
        this.entityId = entityId;
        if ( null != pv )
        {
            this.propertyName = pv.getPropertyName();
            this.propertyType = pv.getPropertyType();
            this.propertyTitle = pv.getDesc();
        }
    }

    public TDataEntityProperty(Map<String, Object> map)
    {
        if ( null != map )
        {
            if ( map.containsKey("id") )
            {
                this.setId( (String)map.get("id"));
            }

            if ( map.containsKey("entityId") )
            {
                this.entityId = (String)map.get("entityId");
            }

            if ( map.containsKey("propertyTitle") )
            {
                this.propertyTitle = (String)map.get("propertyTitle");
            }

            if ( map.containsKey("propertyName") )
            {
                this.propertyName = (String)map.get("propertyName");
            }

            if ( map.containsKey("propertyType") )
            {
                this.entityId = (String)map.get("propertyType");
            }
        }
    }

    public String getEntityId() {
        return entityId;
    }

    public void setEntityId(String entityId) {
        this.entityId = entityId;
    }

    public String getPropertyTitle() {
        return propertyTitle;
    }

    public void setPropertyTitle(String propertyTitle) {
        this.propertyTitle = propertyTitle;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {

        this.propertyName = propertyName;
    }

    public String getPropertyType() {
        return propertyType;
    }

    public void setPropertyType(String propertyType) {
        this.propertyType = propertyType;
    }

    public int getDispIndex() {
        return dispIndex;
    }

    public void setDispIndex(int dispIndex) {
        this.dispIndex = dispIndex;
    }
}
